package com.fyz.aaronfjava.common.config;

import com.fyz.aaronfjava.common.exception.AssertException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author：AaronF
 * @Date：2024/1/31 14:29
 * @description 全局异常捕获
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(AssertException.class)
    public Object assertException(AssertException e) {
       // 返回自定义的响应请求
       return new Object();
    }

    @ExceptionHandler(RuntimeException.class)
    public Object runtimeException(RuntimeException e) {
        // 返回自定义的响应请求
        return new Object();
    }
}
